﻿@model OShop.ViewModels.LocationFieldViewModel
@using OShop.Extensions

@{
    Script.Require("OShop");
}

<fieldset>
    @*<legend>@T("Location")</legend>*@
    <div>
        @Html.LabelFor(m => m.CountryId, T("Country").Text, Model.Settings.Required ? new { @class = "required" } : null)
        @Html.DropDownListFor(m => m.CountryId, Model.Countries.BuildCountrySelectList(), new { @class = "oshop-autoupdate" })
        @Html.ValidationMessageFor(m => m.CountryId)
    </div>
    @if (Model.States.Any()) {
        <div>
            @Html.LabelFor(m => m.StateId, T("State").Text, Model.Settings.Required ? new { @class = "required" } : null)
            @Html.DropDownListFor(m => m.StateId, Model.States.BuildStateSelectList())
            @Html.ValidationMessageFor(m => m.StateId)
        </div>
    }
    else {
        <input type="hidden" name="@Html.NameFor(m => m.StateId)" value="0"/>
    }
</fieldset>
